// 基础电影类型
export interface Movie {
  id: number
  coverUrl: string
  title: string
  rating: number
  tags: string[]
  isAi: boolean
  genres?: string[]
  universe?: string
  language?: string
  year?: number
  country?: string
  views?: number
  updatedAt?: string
  description?: string
}

// 电影详情类型
export interface MovieDetail {
  id: number
  title: string
  originalTitle?: string
  coverUrl: string
  videoUrl?: string
  rating: number
  year: number
  duration: string
  genres: string[]
  description: string
  plot: string
  actors: string[]
  director: string
  uploader: {
    id: string
    name: string
    avatar?: string
  }
  views: number
  likes: number
  isAi: boolean
  universe?: string
  tags: string[]
  language: string
  country: string
  budget?: string
  boxOffice?: string
  awards: string[]
  trivia: string[]
  createdAt: string
  updatedAt: string
}

// 电影详情视图类型（从数据库视图）
export interface MovieDetailView {
  id: number
  title: string
  original_title?: string
  cover_url: string
  video_url?: string
  rating: number
  year: number
  duration: string
  description: string
  plot: string
  actors: string[]
  director: string
  uploader_id?: string
  views: number
  likes: number
  is_ai: boolean
  budget?: string
  box_office?: string
  awards?: string[]
  trivia?: string[]
  cover_file_size?: number
  created_at: string
  updated_at: string
  
  // 用户自定义标签
  user_tags: string[]
  
  // 系统预定义标签
  genres: string[]
  universe: string[]
  language: string[]
  country: string[]
  
  // 标签详细信息
  system_tags_info: any[]
}

// 电影类型枚举
export type MovieType = 'carousel' | 'hot' | 'masonry' | 'category'

// 电影筛选条件
export interface MovieFilters {
  genre?: string
  universe?: string
  language?: string
  country?: string
  ai?: string
}

// 电影加载请求
export interface MovieLoadRequest {
  type: MovieType
  count: number
  offset?: number
  filters?: MovieFilters
}

// 电影上传表单
export interface MovieUploadForm {
  title: string
  originalTitle: string
  year: number
  duration: string
  directors: string[]
  universe: string
  language: string
  country: string
  rating: number
  genres: string[]
  tags: string[]
  actors: string[]
  description: string
  plot: string
  budget: string
  box_office: string
  awards: string[]
  trivia: string[]
  isAi: boolean
}

// 电影编辑表单
export interface MovieEditForm extends MovieUploadForm {
  id?: number
}

// 缓存项类型
export interface CacheItem<T> {
  data: T
  timestamp: number
}

// 电影加载状态
export interface MovieLoadingState {
  isLoading: boolean
  loadingTypes: Set<string>
}
